Appenders for Alert System |
|
Process Platform provides a set of appenders or consumers that can be configured for several purposes. Apart from the appenders provided in Process Platform, you can configure other appenders and consumers as per the requirement. Alerts are routed to various appenders through the <appender> element. The configuration for each of these appenders has been provided below.
The following are the types of Appenders:
- File
- Windows Event Log
- SysLog Consumer
- Socket
File
File appender is the default consumer type that is built into the alert system. By default, this appender writes alerts in the log file <Process_Platform_Installation_Directory>\Logs.
For each process, a log file with the alert and log messages is created. However, a file appender can be configured explicitly and the file name can be specified within the name and value attributes. For example, system#xml_store_service#xml_store_processor.xml is the name of the file in which spaces are replaced by underscore.
The naming convention of the file is as follows:
Process |
Name of the log |
---|---|
Service |
<Organization Name>#<Service Groupr>#<Service Container>.xml |
Monitor |
Monitor.xml |
Gateway |
Gateway.xml |
The following are the types of Appenders:
ProcessNamedDailyRollingFileAppender is the default consumer supported by the Alert system that creates a daily rolling file for each process.
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='processNamefile' /> </category> <appender class='com.eibus.util.logger.appender.ProcessNamedDailyRollingFileAppender' name='processNamefile'> <param name='File' value='%N.xml' /> <param name='DatePattern' value="'.'yyyy-MM-dd" /> <layout class='org.apache.log4j.xml.XMLLayout' /> </appender>
The configuration is as follows:
<category name='com.eibus.management.AlertSystem' additivity='false'> <priority value='info' /> <appender-ref ref='alertfile' /> </category> <appender class='com.eibus.util.logger.appender.ProcessNamedDailyRollingFileAppender' name='alertfile'> <param name='File' value='Alert%N.xml' /> <param name='DatePattern' value="'.'yyyy-MM-dd" /> <layout class='org.apache.log4j.xml.XMLLayout' /> </appender>
OSBasedEventAppender is a combination of NTEventLogAppender and SysLog Appender. The configuration of the appender is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='OSBasedEventAppender' /> </category> <appender name="OSBasedEventAppender"> <layout> <param name="LocationInfo" value="true" /> </layout> </appender>
DB Appender writes alerts in the database specified in the configuration. The configuration of the appender is as follows:
<appender class="com.cordys.logger.appender.CordysZeroConfJDBCAppender" name="dbappender"/> <category name="com.eibus.management.AlertSystem"> <priority value="info" /> <appender-ref ref="OSBasedEventAppender" /> </category> <category name="com.eibus.management.ManagedComponent"> <priority value="info" /> </category> <root> <priority value="error" /> <appender-ref ref="file" /> <appender-ref ref="dbappender" /> </root>
The configuration of the default appenders in Log4j is as follows:
FileAppender writes the alerts in the file specified in the configuration. The configuration is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='FileAppender' /> </category> <appender xmlns='' class='org.apache.log4j.FileAppender' name='FileAppender'> <param name='File' value='<Process_Platform_Installation_Directory>\logs\Alerts.xml' /> <layout class='org.apache.log4j.xml.XMLLayout'> <param name='locationInfo' value='true' /> </layout> </appender>
DailyRollingFileAppender creates a daily rolling file based on the date pattern. The configuration is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='DailyRollingFileAppender' /> </category> <appender xmlns='' class='org.apache.log4j.DailyRollingFileAppender' name='DailyRollingFileAppender'> <param name='File' value='<Process_Platform_Installation_Directory>\logs\Alerts.xml' /> <param name='DatePattern' value='.yyyy-MM-dd' /> <layout class='org.apache.log4j.xml.XMLLayout'> <param name='locationInfo' value='true' /> </layout> </appender>
RollingFileAppender creates a rolling file based on the size. The configuration is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='RollingFileAppender' /> </category> <appender xmlns='' class='org.apache.log4j.RollingFileAppender' name='RollingFileAppender'> <param name='File' value='<Process_Platform_Installation_Directory>\logs\Alerts.xml' /> <param name='MaxFileSize' value='10MB' /> <param name='MaxBackupIndex' value='5' /> <layout class='org.apache.log4j.xml.XMLLayout'> <param name='locationInfo' value='true' /> </layout> </appender>
Windows Event Log
NTEventLogAppender publishes alerts to Windows event log. The configuration details are as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='NTEventLogAppender' /> </category> <appender xmlns='' class='org.apache.log4j.nt.NTEventLogAppender' name='NTEventLogAppender'> <layout class='org.apache.log4j.SimpleLayout' /> <param name='source' value='CordysLogger' /> </appender>
For more information, see Sending Alerts to Windows Event Log.
SysLog Consumer
A SysLog appender is the default consumer configured for the Linux Operating System. It can also be used on Windows Operating System by modifying the setting <syslogserver> to the system in which the syslogd service is running. A SysLog appender can be configured by specifying the following settings in the configuration file:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='SyslogAppender' /> </category> <appender xmlns='' class='org.apache.log4j.net.SyslogAppender' name='SyslogAppender'> <param name='syslogHost' value='<machinename>' /> <param name='Facility' value='local6' /> <layout class='org.apache.log4j.SimpleLayout' /> </appender>
For more information, see Sending Alerts to SysLog.
Socket Appender
A socket appender publishes alerts to the socket. The configuration is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='SocketAppender' /> </category> <appender xmlns='' class='org.apache.log4j.net.SocketAppender' name='SocketAppender'> <param name='Port' value='4445' /> <param name='RemoteHost' value='<machinename>' /> <layout class='org.apache.log4j.xml.XMLLayout'> <param name='locationInfo' value='true' /> </layout> </appender>
An E-mail consumer publishes alerts to the mail ID specified in the configuration file. While configuring an E-mail consumer ensure that:
- Port 25 is enabled for the functioning of E-mail appender and other services which are running on the port are disabled.
- The mail.jar file (in
<Process_Platform_install_dir>/ext
) is placed in the classpath of the service container / web server. - Multiple addresses specified in the To parameter are separated by a coma.
The configuration of the E-mail consumer is as follows:
<category name="com.eibus.management.AlertSystem"> <priority value="info" /> <appender-ref ref="e-mail" /> </category> <appender class="org.apache.log4j.net.SMTPAppender" name="e-mail"> <param name="SMTPHost" value="ADDRESS-OF-SMTP-Host" /> <param name="To" value="DESTINATION@EMAIL" /> <param name="From" value="SENDER@EMAIL" /> <param name="EvaluatorClass" value="com.eibus.util.logger.TriggerEvent"/> Â <param name="subject" value="Process Platform Alert"/> <layout class="org.apache.log4j.HTMLLayout"> <param name="LocationInfo" value="true" /> </layout> </appender>
To view an example on configuring an alert, see sending Alerts to E-mail.
Multiple appenders can be configured simultaneously by specifying the the corresponding <appender-ref> under <category> element.
The sample code for the configuration of multiple appenders is as follows:
<category name='com.eibus.management.AlertSystem'> <priority value='info' /> <appender-ref ref='processNamefile' /> <appender-ref ref='e-mail' /> </category> <appender class='com.eibus.util.logger.appender.ProcessNamedDailyRollingFileAppender' name='processNamefile'> <param name='File' value='%N.xml' /> <param name='DatePattern' value=".'yyyy-MM-dd" /> <layout class='org.apache.log4j.xml.XMLLayout' /> </appender> <appender class='org.apache.log4j.net.SMTPAppender' name='e-mail'> <param name='SMTPHost' value='ADDRESS-OF-SMTP-Host' /> <param name='To' value='DESTINATION@EMAIL' /> <param name='From' value='SENDER@EMAIL' /> <layout class='org.apache.log4j.xml.XMLLayout' /> </appender>
For more information, see configuring Multiple Appenders.